package cn.dlc.com.graph;

import cn.dlc.com.stack.Stack;

/**
 * @author 邓立川
 * @date 2021/3/30 22:11
 * @desc 当前类的描述信息
 */
public class TopLogicalTest {

    public static void main(String[] args) {
        // 初始化一个图
        Digraph digraph = new Digraph(6);

        digraph.addEdge(0,2);
        digraph.addEdge(0,3);
        digraph.addEdge(2,4);
        digraph.addEdge(3,4);
        digraph.addEdge(4,5);

        digraph.addEdge(1,3);

        // 调用拓扑排序
        TopLogical topLogical = new TopLogical(digraph);

        // 获取排序顶点
        Stack<Integer> order = topLogical.order();

        System.out.println(order == null);


        for (Integer node : order) {
            System.out.println(node);
        }
    }
}
